home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / DDJMAG / DDJ9110.ZIP / STRING.ZIP / STRIGT.CPP < prev    next >
C/C++ Source or Header  |  1991-07-30  |  733b  |  29 lines

  1. #include <string.h>
  2. #include <ctype.h>
  3. #include <errno.h>
  4. #include <string.hpp>
  5.  
  6. int operator>(const String &a, const String &b)
  7. {
  8.     int c, m = a.length(), n = b.length(), l = m > n? n: m;
  9.     if ((c = memcmp(a.body(),b.body(),l)) > 0) return 1;
  10.     if (!c && m > n) return 1;
  11.     return 0;
  12. }
  13.  
  14. int operator>(const String &a, const char *s)
  15. {
  16.     int c, m = a.length(), n = strlen(s), l = m > n? n: m;
  17.     if ((c = memcmp(a.body(),s,l)) > 0) return 1;
  18.     if (!c && m > n) return 1;
  19.     return 0;
  20. }
  21.  
  22. int operator>(const char *s, const String &a)
  23. {
  24.     int c, m = strlen(s), n = a.length(), l = m > n? n: m;
  25.     if ((c = memcmp(s,a.body(),l)) > 0) return 1;
  26.     if (!c && m > n) return 1;
  27.     return 0;
  28. }
  29.